package com.crawler.waf.exceptions.extendExceptions;

import org.springframework.http.HttpStatus;

import com.crawler.waf.exceptions.messages.ErrorMessage;
/**
 * 定义简单的异常类对象。
 *
 */
@SuppressWarnings("serial")
public class WafSimpleException extends RuntimeException implements WafExceptionSupport, CustomExceptionSupport {

    private String code="WAF/INTERNAL_SERVER_ERROR";
    private HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
	
	public WafSimpleException(String message) {
		super(message);
	}
	
	public WafSimpleException(String code,String message) {
		
		super(message);
		this.code = code;
	}
	
	public WafSimpleException(HttpStatus status,String code,String message) {
		super(message);
		this.code = code;
		this.status = status;
	}

	@Override
	public ErrorMessage getErrorMessage() {
		ErrorMessage em = new ErrorMessage();
		em.setCode(code);
		em.setMessage(super.getMessage());
		return em;
	}

	@Override
	public HttpStatus getStatus() {
		return status;
	}

}
